from django.template import Library
import copy
from django.conf import settings

register = Library()
@register.inclusion_tag('tag/menu.html')
def jk_menu(request):
    # print(request.user.role)
    user_menu_list = copy.deepcopy(settings.MENU[request.user.role])
    for item in user_menu_list:
        for child in item["children"]:
            if child["name"] == request.user.menu_name:
                child["class"] = 'active'
    return {"menu_list": user_menu_list}

